import React from "react";

export default function Menu(props) {
  const { parentId, name, children}  = props;

  const menu = () => {
    let ele = null
    if (children) {
      if (parentId !== 0) {
        ele = (<li><a href="#">{name}</a><ul>{children}</ul> </li>)
      } else {
        ele = <>{children}</>
      }
    } else {
        ele = <li><a href="#">{name}</a></li>
    }
    return ele
  };

  return menu();
}
